<?php
namespace app\scodetrace\model;

class ScodeLog extends \app\common\model\Base{
	protected $autoWriteTimestamp=false;
	protected $table='xl_scode_log';

	// protected $type=[
		// 'querytime'=>'datetime:Y-m-d h:m:s',
	// ];

	// protected $createTime='querytime';
	// protected $updateTime= null;
	//protected $visible=['querytime'];
	protected $hidden=['create_time','area_id'];
	protected $append=['area','query_time'];

	public function AreaInfo(){
		return $this->belongsTo("baseinfo/Area");
	}

	public function getAreaAttr($value,$data){
		$value=$data['area_id'];
		if ($value){
			if ($o=Area::get($value))
				return $o->getAttr('name');
			else
				return NULL;
		} else {
			return NULL;
		}
	}

	public function getQuerytimeAttr($value,$data){
		return date("Y-m-d h:i:s",$data['create_time']);
	}

}

